package com.matt.service.remoteCall;

import com.dotflat.staffExtend.po.*;
import com.matt.commons.dto.sso.AreaDTO;
import com.matt.commons.dto.sso.StaffDTO;
import com.matt.commons.model.StatusResponse;
import com.matt.commons.page.PagerQuery;
import com.matt.domain.CreateStaff;
import com.matt.foundation.DO.TeacherDO;
import com.matt.foundation.dto.AreaDetailDTO;
import com.matt.foundation.dto.AreaSettingDTO;
import com.matt.foundation.dto.PlatformMenuDto;
import com.matt.service.remoteCall.DTO.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

import static com.matt.foundation.constant.RequestConstant.TICKET;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/6/25
 * *******************************
 */
public interface SsoCallService {

    //当前用户基本信息
    StaffDTO getStaffDTO(String ticket);

    Map getStaffDTO2(String ticket);

    StaffDTO getStaffDTO(String ticket, String staffId);
    //指定用户基本信息
    StaffExtendInfoPO2 getStaffExtendDTO(String ticket, String staffId);

    StaffDTO getStaffDTOByPhone(String ticket, String phone);

    StaffDTO updateStaff(String ticket, StaffDTO staffDTO);

    StaffDTO updateStaff2(String ticket, StaffDTO staffDTO,List<String> roles,String paramJson);

    StaffDTO updateStaff3(String ticket,String paramJson);

    StaffDTO quitStaff(String ticket, String areaId, String staffId);

    StaffDTO staffEntry(String ticket, String areaId, String staffId);

    StaffDTO quitStaff(String ticket, String staffId);

    StaffDTO staffEntry(String ticket, String staffId);

    //创建用户
    StaffDTO createStaff(String ticket, StaffDTO staffDTO);

    //创建用户并同事指定园区的roles，需要用ticket限定role和staff的areaId
    StaffDTO createStaff(String ticket, StaffDTO staffDTO, String[] roles);

    //创建用户
    StaffDTO createStaff2(String ticket, StaffDTO staffDTO,String paramJson);

    //创建用户并同事指定园区的roles，需要用ticket限定role和staff的areaId
    StaffDTO createStaff2(String ticket, StaffDTO staffDTO, List<String> roles,String paramJson);

    Map resetPassword(String ticket, String oldPassword, String newPassword);

    //验证码修改密码
    String forgetPassword( String phone, String verifyCode,String newPassword);

    String passLogin(String mobile, String password, String ip, int term,String platformId);

    String groupPassLogin(String mobile, String password, String ip, int term,String platformId);

    //根据id获取用户列表
    List<StaffDTO> getStaffDTOList(String ticket, String[] ids);

    List<StaffDTO> getStaffDTOList(String ticket, String permission);

    List<StaffDTO> getStaffDTOList(String areaId);

    //权限
    Map getPermissionInfoV2(String ticket, int term,String platformId);
    Map getPermissionInfoV2(String ticket,String platformId);

    RoleDTO getStaffRole(String ticket);

    RoleDTO setDefaultRole(String ticket, String roleId);

    RoleDTO getDefaultRole(String ticket);

    List<RoleDTO> getStaffRoleList(String ticket);

    //根据员工id获取角色列表
    List<RoleDTO> getStaffRoleList(String ticket, String staffId);

    //重置员工角色表，需同事更新默认角色
    void setStaffRoleList(String ticket, String staffId, String[] roleIds);


    //获取角色对应的资源，Menu对象，可能需要修改MenuDTO对象字段
    //term为0时 web端，   1时 app端,   2时小程序端
    List<PlatformMenuDto> getTermMenus(String ticket, int term, String platformId);

    //获取角色对应的资源，Menu对象，可能需要修改MenuDTO对象字段
    //term为0时 web端，   1时 app端,   2时小程序端
    List<PlatformMenuDto> getRoleMenus(String ticket, String roleId, int term,String platformId);

    //设置角色对应的资源
    RoleDTO setRoleMenus(String ticket, String roleId, String[] menuIds, int term,String platformId);

    List<RoleCountDO> getAreaRoles(String ticket, boolean staffCount);

    RoleDTO addAreaRole(String ticket, RoleDTO role);

    void removeAreaRole(String ticket, RoleDTO role);

    RoleDTO updateAreaRole(String ticket, RoleDTO role);

//    List<StaffDTO> getAreaStaffByRole(String ticket, String roleId, PagerQuery pagerQuery);

    Boolean checkStaffPermission(String ticket, String[] permission);


    //短信
    Boolean send_sms(String mobile);

    Boolean validSmsCode(String phone,String code);


    //园区
    AreaDTO getAreaDTO(String ticket);
    AreaDetailDTO getAreaDetailDTO(String ticket);

    //所有任职园区
    List<AreaListDTO> getInChargeArea(String ticket);

    AreaDTO setDefaultArea(String ticket, String areaId);

    AreaDTO getDefaultArea(String ticket);

    //园区上级集团所有园区
    List<AreaDTO>  getStaffGroupByAreaList(String ticket);

    //园区上级集团所有园区
    List<SsoAreaDTO> getGroupAllArea(String ticket);

    //
    Map getGroupAllStaff(String ticket, String areaId, String roleId, String realName,
                                       Integer pageNum, Integer pageSize );

    //查询某园所未删除 未离职状态的员工ID
    List<String> getNormalStaffIdByArea(String ticket, String areaId);

    //统计信息
    List<StaffPageDO> getAreaStaffList(String ticket, String name, String roleID, PagerQuery pagerQuery);

    Map getAreaStaffs(String ticket, String realName, String roleId,Integer status, PagerQuery pagerQuery);

    Map getAreaStaffsV2(String ticket, String realName, String roleId,Integer status,String isNotStaffIds,String staffIds, PagerQuery pagerQuery);


    List<StaffPageDO> getAreaStaffListByPermission(String ticket, String permission, PagerQuery pagerQuery);

    //园区设置
    AreaSettingDTO getAreaSetting(String key, String areaId);
    List<AreaSettingDTO> getAllAreaSettings(String areaId, String prefix);

    Boolean addAreaSetting(String key, String value, String description, String extension, String areaId);
    Boolean addAreaSetting(String key, String value, String description, String extension, String areaId, String type);

    Integer addAreaSettings(String keys, String values, String description, String extension, String areaId);

    //查询字典
    List<DictDataDTO> getDictData(String ticket, DictDataDTO dictData);

    //添加字典
    Integer addDictData(String ticket, DictDataDTO dictData);

    //删除字典
    Integer delDictData(String ticket, String dictCode);

    //修改字典
    Integer updateDictData(String ticket, DictDataDTO dictData);

    //查询单个字典
    DictDataDTO dictCodeByDictData(String ticket, String dictCode);

    //查询用户和园区名称  返回 staffName，areaName
    Map getStaffNameAndAreaName(String staffId,String areaId);

    //根据经纬度查询附近的num数量的园区
    List<AreaDTO> areasByLocation(float lat, float lon, Integer num);

    //根据pcacode查询园区, 参数二选一，pcaCode右侧模糊匹配, pcaName 前后模糊匹配
    List<AreaDTO> areasByLocation(String pcaCode, String pcaName);

    //园区上级集团所有关联的用户
    List<AreaStaffDTO>  getStaffAreaList(String ticket);

    //字典是否存在
    boolean isData(String ticket,DictDataDTO dataDTOS);

    //字典是否存在，为true是不存在
    boolean isDataList(String ticket,List<DictDataDTO> dataDTOS);

    //查询用户园区的角色集合和基本信息
    List<StaffInfoDTO> getStaffInfoList(String ticket,List<String> staffIds);

    public List<GroupDTO> getStaffGroupList(String ticket);

    List<AreaDTO>  getAllArea();

    List<AreaDTO>  getAreaName(String name);

    String getAreaGroupAdmin(String ticket);

    String getAreaGroupId(String ticket);

    AppEditionDTO getEditionCode(String ticket,String appId,String appVersion,Integer type,String wgtVersion);


    /**
     * 新增或编辑绩效评估
     * @param performanceDetailPO
     * @return
     */
    StatusResponse saveOrUpdatePerformance(String ticket,PerformanceDetailPO performanceDetailPO);


    /**
     * 绩效评估详情
     * @param month
     * @param year
     * @param staffId
     * @return
     */
    PerformanceDetailPO detail(PerformanceQueryPO performanceQueryPO);


    /**
     * 绩效评估列表查询
     * @return
     */
    Map performanceList(String ticket, PerformanceQueryPO performanceQueryPO);


    /**
     * 绩效评估详情
     * @return
     */
    Map remove(String id);

    /**
     * 导出
     * @param response
     * @param ticket
     * @param performanceQueryPO
     * @return
     */
    List<PerformanceExcelPO> exportPerformance(HttpServletResponse response, @RequestHeader(TICKET)String ticket, @RequestBody PerformanceQueryPO performanceQueryPO);

    /**
     * 根据班级id获取教师 staff_id集合
     * @param classId
     * @return
     */
    List<TeacherDO> getTeacherByClassId(String classId);

    String create1(CreateStaff createStaff);
}
